﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bluyel.Core
{
    /// <summary>
    /// Simple Type System core.
    /// 
    /// Manage types for applications.
    /// 
    /// Create types and data, with factories.
    /// </summary>
    public class BluyelCore
    {
        FactoryMgrBase _factoryMgr;

        /// <summary>
        /// Manager of general availables types, and list of type.
        /// </summary>
        TypeMgrBase _typeMgr;

        /// <summary>
        /// Manager of physical quantity types.
        /// </summary>
        //TypePhyMgr _typePhyMgr;

        /// <summary>
        /// Manager of list of data named.
        /// </summary>
        ListDataMgr _listDataMgr;

        /// <summary>
        /// The type builder manager.
        /// </summary>
        TypeBuilderBase _typeBuilder;

        TypeFinderBase _typeFinder;

        ValueBuilder _valueBuilder;

        DataBuilder _dataBuilder;

        /// <summary>
        /// To convert value, from a type to another one.
        /// </summary>
        ValueConverter _valueConverter;

        //PhyConverter _phyConverter;

         //====================================================================
        #region Constructor.

        //---------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="factory"></param>
        public BluyelCore()
        {
            _factoryMgr = new FactoryMgrBase();
            _typeMgr = new TypeMgrBase();
            //_typePhyMgr = new TypePhyMgr();
            _listDataMgr = new ListDataMgr();

            _typeFinder = new TypeFinderBase(_typeMgr);
            _valueBuilder = new ValueBuilder(_factoryMgr, _typeMgr, _typeFinder);

            _typeBuilder = new TypeBuilderBase(_factoryMgr, _typeMgr, _typeFinder);

            _dataBuilder = new DataBuilder(_factoryMgr, _typeMgr, _typeFinder, _listDataMgr);

            _valueConverter = new ValueConverter(_typeMgr, _typeFinder, _valueBuilder);
            //_phyConverter = new PhyConverter(_typeMgr, _typeFinder, _valueBuilder);

        }
        #endregion

        //=====================================================================
        #region Public Properties.

        //---------------------------------------------------------------------
        public FactoryMgrBase FactoryMgrBase
        { get { return _factoryMgr; } }

        //---------------------------------------------------------------------
        public TypeMgrBase TypeMgrBase
        { get { return _typeMgr; } }

        //---------------------------------------------------------------------
        public TypeBuilderBase TypeBuilder
        {
            get { return _typeBuilder; }
        }

        //---------------------------------------------------------------------
        public TypeFinderBase TypeFinder
        {
            get { return _typeFinder; }
        }

        //---------------------------------------------------------------------
        public ValueBuilder ValueBuilder
        {
            get { return _valueBuilder; }
        }

        //---------------------------------------------------------------------
        public DataBuilder DataBuilder
        {
            get { return _dataBuilder; }
        }

        //---------------------------------------------------------------------
        public ValueConverter ValueConverter
        {
            get { return _valueConverter; }
        }

        //---------------------------------------------------------------------
        //public PhyConverter PhyConverter
        //{
        //    get { return _phyConverter; }
        //}

        #endregion


        //=====================================================================
        #region xxx methods.

        #endregion

    }
}
